//Vuex 配置


//引入Api
import {createStore} from 'vuex'


import moduleA from '@/modules/moduleA'
import moduleB from '@/modules/moduleB'


//创建一个实例化的vue对象

const store = createStore({
    modules:{
       a: moduleA,
       b: moduleB
    },
   state(){
    return {
        count: 0
    }
   },
   getters: {
    tenTimes: (state) =>{
        return state.count * 10
    }
   },
   mutations:{
    increment(state,playload){
        state.count = playload.count
    }
   },
   actions:{
    asyncIncrement(context,playload) {
        context.commit('increment',playload)
    }
}
})

//将实例化对象对外暴露
export default store